Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows Fn::GetAtt with Lambda DLQ-onError #5139

Merged
merged 2 commits into from
Jan 28, 2019
Merged

Conversation

martinjlowm
Copy link

What did you implement:

Arn references for SQS queues are now available using:

Fn::GetAtt:
  - Queue
  - Arn

How did you implement it:

According to https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sqs-queues.html#aws-properties-sqs-queues-ref an SQS reference returns its URL which is not sufficient for Lambda DLQ config which requires an ARN.

isArnRefOrImportValue is renamed to isArnRefGetAttOrImportValue and extended to also look for Fn::GetAtt.

How can we verify it:

Write a minimal Serverless setup that mimics that of the new test: 'should create necessary resources if a Fn::GetAtt is provided'.

Todos:

  • Write tests
  • Write documentation
  • Fix linting errors
  • Make sure code coverage hasn't dropped
  • Provide verification config / commands / resources
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: Yes
Is it a breaking change?: NO

Arn references for SQS queues are now available using:

```
Fn::GetAtt:
  - Queue
  - Arn
```
@vKongv
Copy link

vKongv commented Aug 27, 2018

Does this solve the race condition mentioned in the doc? https://serverless.com/framework/docs/providers/aws/guide/functions#dlq-with-sqs

@martinjlowm
Copy link
Author

I'm not sure. I haven't experienced the race condition myself with this patch and I have done a couple of fresh re-deployments.

@lglapinski
Copy link

Can we expect any review in near future?

@bayoudhi
Copy link

bayoudhi commented Nov 4, 2018

Can we expect any review in near future please !!!

@pmuens pmuens self-assigned this Jan 25, 2019
Copy link
Contributor

@pmuens pmuens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this @martinjlowm 👍

Just tested it with the following configuration:

service: test # NOTE: update this with your service name

provider:
  name: aws
  runtime: nodejs8.10
  iamRoleStatements:
  - Effect: Allow
    Action:
      - sqs:SendMessage
      - sqs:DeleteMessage
      - sqs:ReceiveMessage
    Resource: arn:aws:sqs:*:*:SampleQueue

functions:
  hello:
    handler: handler.hello
    onError:
      Fn::GetAtt:
        - MyQueue
        - Arn

resources:
  Resources:
    MyQueue:
      Type: AWS::SQS::Queue
      Properties:
        QueueName: SampleQueue

Works like expected 👍

Just pushed another minor doc update. Will merge once the build is green :shipit:

@pmuens pmuens merged commit 4ae0ff1 into serverless:master Jan 28, 2019
@pmuens pmuens added this to the 1.36.4 milestone Feb 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants